(function(){"use strict";BX.namespace("BX.Landing.Collection");var t=BX.Landing.Utils.isFunction;var n=BX.Landing.Utils.isEmpty;BX.Landing.Collection.BaseCollection=function(){Array.apply(this,arguments)};BX.Landing.Collection.BaseCollection.createFromArray=function(t){var n=new BX.Landing.Collection.BaseCollection;if(BX.type.isArray(t)){t.forEach(n.push,n)}return n};BX.Landing.Collection.BaseCollection.prototype={constructor:BX.Landing.Collection.BaseCollection,__proto__:Array.prototype,add:function(t){if(!this.contains(t)){this.push(t)}},fetchAttrs:function(){var t=new BX.Landing.Collection.BaseCollection;this.fetchFields().forEach(function(n){if(n.type==="attr"){t.push.apply(t,n.fields)}});return t},getByIndex:function(t){return this[t]},remove:function(t){var n=this.getIndex(t);if(n>-1){this.splice(n,1)}},getIndex:function(t){return this.indexOf(t)},contains:function(t){return this.getIndex(t)!==-1},isChanged:function(){return this.some(function(t){return t.isChanged()})},fetchValues:function(){var n={};this.forEach(function(e){if(e.selector.split("@")[1]!=="-1"){if(t(e.getAttrValue)){n[e.selector]=e.getAttrValue()}else{n[e.selector]=e.getValue()}}});return n},fetchAdditionalValues:function(){return this.reduce(function(t,e){if(e.selector.split("@")[1]!=="-1"&&e.getAdditionalValue){var i=e.getAdditionalValue();if(!n(i)){t[e.selector]=i}}return t},{})},fetchChanges:function(){var t=new BX.Landing.Collection.BaseCollection;this.forEach(function(n){if("isChanged"in n&&"getValue"in n&&n.isChanged()){t.add(n)}});return t},clear:function(){this.splice(0,this.length)},toArray:function(){return this.map(function(t){return t})},filter:function(t,n){var e=new this.constructor;this.forEach(function(i){if(t.apply(n,arguments)){e.push(i)}});return e},get:function(t){var n=null;this.some(function(e){if(e.id==t){n=e;return true}});return n},getByLayout:function(t){return this.find(function(n){return BX.Type.isObject(n)&&n.layout===t})}}})();
//# sourceMappingURL=base_collection.map.js